package com.wenyl.juc.thread.saleTickets;

/**
 * @author Swimming Dragon
 * @description: TODO
 * @date 2024年11月07日 11:41
 */
public class CustomerRunnable implements Runnable{
    private Tickets tickets;
    public CustomerRunnable(Tickets tickets){
        this.tickets = tickets;
    }
    @Override
    public void run() {
        tickets.buyTicket(1);
        System.out.println(Thread.currentThread().getName()+"购票成功，余票"+tickets.getAllowance());
    }
}
